//NvTempItem.qml
import QtQuick 2.15
import org.ukui.nvtemp 1.0

Rectangle {
    implicitWidth: 190
    implicitHeight: 40
    radius: 6
    color: Qt.rgba(255, 255, 255, 0.5)
    border.color: "black"

    NvTemp {
        id: nvTemp
    }

    Text {
        id: text
        anchors.centerIn: parent
        text: "GPU温度：" + nvTemp.getGpuTemperature
        font.pointSize: 12
    }

    Component.onCompleted: {
        nvTemp.tempChanged.connect(() => {
            text.text = "GPU温度：" + nvTemp.getGpuTemperature
        })
    }
    Component.onDestruction: {
        nvTemp.tempChanged.disconnect()
    }

}